using System;
using System.Collections.Generic;
using System.Text;
using MyPhotoIndex.Interfaces.Tagging;

namespace MyPhotoIndex.ImageBank
{
    public class TaggingAssistant
    {
        private IImageTag m_tag;

        public TaggingAssistant(string tagName)
        {
            IImageTag[] tags = ImageTagCollection.Instance.GetTagByName(tagName);
            if (tags.Length == 0)
            {
                String importedTagsCategoryName = "Imported tags";
                IImageTag importedTagsTag = ImageTagCollection.Instance.GetTagByPath(importedTagsCategoryName);
                m_tag = ImageTagCollection.Instance.Create(importedTagsTag, tagName);
                ImageTagCollection.Instance.SaveTag(m_tag);
            }
            else
            {
                m_tag = tags[0];
            }
        }

        public IImageTag Tag
        {
            get { return m_tag; }
        }
    }
}
